package com.kgc.springboot.hangduo.service.impl;

import com.kgc.springboot.hangduo.mapper.CollectMapper;
import com.kgc.springboot.hangduo.pojo.Collect;
import com.kgc.springboot.hangduo.pojo.CollectExample;
import com.kgc.springboot.hangduo.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: ASUS
 * @date: 2021/1/10 18:26
 * @description:
 */
@Service
public class CollectServiceImpl implements CollectService {
    @Autowired
    private CollectMapper collectMapper;
    @Override
    public List<Collect> selectAllByClientId(Integer id) {
        CollectExample collectExample = new CollectExample();
        collectExample.createCriteria().andClientIdEqualTo(id);
        List<Collect> collects = collectMapper.selectByExample(collectExample);

        return collects;
    }

    @Override
    public int addCollect(Collect collect) {
        return collectMapper.insertSelective(collect);
    }

    @Override
    public int delCollect(Integer id) {
        return collectMapper.deleteByPrimaryKey(id);
    }
}
